package com.cudex.mb;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.cudex.negocio.factory.IBarracaManager;

/**
 * @author Administrador
 * 
 */

@ManagedBean
@ViewScoped
public class ClienteBean {

	
	@EJB
	IBarracaManager manager;
	
	
	private int id;
	private String name;
	private String rSocial;
	private String rut;
	
	private String email;
	private String dir;
	private String tel;
	
	private Date ingreso;
	
	

	private List<ClienteBean> clientesList = null;

	// Datos Prueba
	private static final ClienteBean[] cBeans = {

			new ClienteBean(1, "Saceem", "123456789123", "saceem@saceem.com",
					"Treinta y Tres ", "9152000", new Date()),
			new ClienteBean(2, "Cliente 2", "456789555", "saceem@saceem.com",
					"Direccion 2", "9631234", new Date()),
			new ClienteBean(3, "Cliente 3", "256412315", "saceem@saceem.com",
					"Calle 3", "5554612", new Date()),
			new ClienteBean(4, "Hierromat", "1123654789", "saceem@saceem.com",
					"Direccion Hierromat", "5465123", new Date()),
			new ClienteBean(5, "Timber SA", "1123654789", "saceem@saceem.com",
					"Direccion Timber", "4584654", new Date()) };

	public ClienteBean(int id, String name, String rut, String email,
			String dir, String tel, Date ingreso) {
		this.id = id;
		this.name = name;
		this.rut = rut;
		this.email = email;
		this.dir = dir;
		this.tel = tel;
		this.ingreso = ingreso;
	}

	public ClienteBean() {
		// TODO Auto-generated constructor stub
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getrSocial() {
		return rSocial;
	}

	public void setrSocial(String rSocial) {
		this.rSocial = rSocial;
	}

	public String getRut() {
		return rut;
	}

	public void setRut(String rut) {
		this.rut = rut;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getDir() {
		return dir;
	}

	public void setDir(String dir) {
		this.dir = dir;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public Date getIngreso() {
		return ingreso;
	}

	public void setIngreso(Date ingreso) {
		this.ingreso = ingreso;
	}

	public List<ClienteBean> getClientesList() {
		if (clientesList == null) {
			 clientesList = new ArrayList<ClienteBean>(Arrays.asList(cBeans));
			//clientesList = new ArrayList<ClienteBean>();
		}
		return clientesList;
	}

	public void setClientesList(List<ClienteBean> clientesList) {
		this.clientesList = clientesList;
	}

	
	public String guardar(){
		return "";
	}
	
	public String modificar(){
		return "";
	}
	public String borrar(){
		return "";
	}
	
	public String cancelar(){
		return "dashboard.xhtml";
	}
	
	
}
